﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>ProClinic-医院管理系统Bootstrap4前端框架</title>
    <!-- Fav  Icon Link -->
    <link rel="shortcut icon" type="image/png" href="images/fav.png">
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- themify icons CSS -->
    <link rel="stylesheet" href="css/themify-icons.css">
    <!-- Main CSS -->
    <link rel="stylesheet" href="css/styles.css">
    <link rel="stylesheet" href="css/green.css" id="style_theme">
    <link rel="stylesheet" href="css/responsive.css">

    <script src="js/modernizr.min.js"></script>
</head>

<body class="auth-bg">
<!-- Pre Loader -->
<div class="loading">
    <div class="spinner">
        <div class="double-bounce1"></div>
        <div class="double-bounce2"></div>
    </div>
</div>
<!--/Pre Loader -->
<!-- Color Changer -->
<div class="theme-settings" id="switcher">
		<span class="theme-click">
			<span class="ti-settings"></span>
		</span>
    <span class="theme-color theme-default theme-active" data-color="green"></span>
    <span class="theme-color theme-blue" data-color="blue"></span>
    <span class="theme-color theme-red" data-color="red"></span>
    <span class="theme-color theme-violet" data-color="violet"></span>
    <span class="theme-color theme-yellow" data-color="yellow"></span>
</div>
<!-- /Color Changer -->
<div class="wrapper">
    <!-- Page Content  -->
    <div id="content">
        <div class="container">
            <div class="row">
                <div class="col-sm-6 auth-box">
                    <div class="lochana-box-shadow">
                        <h3 class="widget-title">AdminLogin</h3>
                        <form class="widget-form" id="uploadForm">
                            <!-- form-group -->
                            <div class="form-group row">
                                <div class="col-sm-12">
                                    <input id="username" name="user" placeholder="Username" class="form-control"
                                           required=""
                                           data-validation="length alphanumeric" data-validation-length="3-12"
                                           data-validation-error-msg="User name has to be an alphanumeric value (3-12 chars)"
                                           data-validation-has-keyup-event="true">
                                </div>
                            </div>
                            <!-- /.form-group -->
                            <!-- form-group -->
                            <div class="form-group row">
                                <div class="col-sm-12">
                                    <input id="password" type="password" placeholder="Password" name="pass_confirmation"
                                           class="form-control" data-validation="strength" data-validation-strength="2"
                                           data-validation-has-keyup-event="true">
                                </div>
                            </div>
                            <!-- /.form-group -->
                            <!-- Login Button -->
                            <div class="button-btn-block">
                                <button type="button" class="btn btn-primary btn-lg btn-block">Login</button>
                            </div>
                            <!-- /Login Button -->
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /Page Content  -->
</div>
<!-- Jquery Library-->
<script src="js/jquery-3.2.1.min.js"></script>
<!-- Popper Library-->
<script src="js/popper.min.js"></script>
<!-- Bootstrap Library-->
<script src="js/bootstrap.min.js"></script>
<!-- Custom Script-->
<script src="js/custom.js"></script>

<script>
    $(".btn-block").click(function () {
        let username = $('#username').val();
        let password = $('#password').val();

        $.ajax({
            type: 'POST',
            data: {
                username: username,
                password: password
            },
            url: '/admin/login',
            dataType: 'json'
        }).done((result) => {
            if (result.data) {
                alert("登录成功");
                location.href = "./index.html";
            } else {
                alert(" 登录失败");
            }
        }).fail(() => {
            alert("登录失败");
        });

    });
</script>
</body>
</html>